digit [0-9]
letter [A-Za-z]
%{
in count;
int intger;
%}
%%
/* match identifier */
{letter}({letter}|{digit})* count++;
{digit}+ integer++;
%%
int yywrap(void) {
return 1;
}
int main(int argc, char *argv[]) {
yyin = fopen(argv[1], "r");
count = 0;
integer = 0;
yylex();
fclose (yyin);
printf("number of identifiers = %d\n", count);
printf("number of integers = %d\n", integer);
return 0;
}